home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / plot.dxr / 00164.ls < prev    next >
Encoding:
Text File  |  2000-08-01  |  1.3 KB  |  46 lines

  1. on mouseUp
  2.   set the trails of sprite 19 to 1
  3.   if field "A" > 4 then
  4.     put 4 into field "A"
  5.   end if
  6.   if field "A" < -4 then
  7.     put -4 into field "A"
  8.   end if
  9.   if field "B" > 10 then
  10.     put 10 into field "B"
  11.   end if
  12.   if field "B" < 0 then
  13.     put 1 into field "B"
  14.   end if
  15.   set x0 to the locH of sprite 12 + 1
  16.   set y0 to the locV of sprite 12
  17.   set period to float(field "B")
  18.   if the hilite of cast "Degrees" then
  19.     set phase to float(field "C" * PI / 180.0)
  20.   else
  21.     set phase to field "C"
  22.   end if
  23.   if the foreColor of sprite 19 >= 6 then
  24.     set the foreColor of sprite 19 to 0
  25.   else
  26.     set the foreColor of sprite 19 to the foreColor of sprite 19 + 1
  27.   end if
  28.   repeat with n = 0 to 240
  29.     set the locH of sprite 19 to (2.39999999999999991 * n) + x0
  30.     if the hilite of cast "Sine" then
  31.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(sin((float(period * n * 3.0) * PI / 180.0) + phase)))
  32.     end if
  33.     if the hilite of cast "Cosine" then
  34.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(cos((float(period * n * 3.0) * PI / 180.0) + phase)))
  35.     end if
  36.     if the hilite of cast "Tangent" then
  37.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(tan((float(period * n * 3.0) * PI / 180.0) + phase)))
  38.     end if
  39.     updateStage()
  40.   end repeat
  41. end
  42.  
  43. on mouseDown
  44.   button()
  45. end
  46.